package cn.blossoming.controller.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Objects;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class ApiResult<T> {
    private String result = "success";
    private String msg = "请求成功";
    private int code = 200;
    private T data;

    public ApiResult(T data) {
        if (Objects.isNull(data))
            data = (T) "";
        this.data = data;
    }

    public static <T> ApiResult<T> builder(T data) {
        return new ApiResult<>(data);
    }

}
